package cn.caplike.demo.rabbitmq.springboot.idempotence_reliability.port.adapter.persistence.mybatis;

import java.util.Objects;

/**
 * Description: 基础 Provider
 *
 * @author LiKe
 * @version 1.0.0
 * @date 2020-09-03 16:55
 */
public abstract class BaseRepositoryProvider {

    public static final String KEY_ENTITY = "entity";

    public static final String KEY_UPDATE_FIELDS = "updateFields";

    static void nonNullAnd(Object param, Runner runner) {
        if (Objects.nonNull(param))
            runner.run();
    }

    static String getSqlValue(Object value) {
        return "\"" + value + "\"";
    }

    /**
     * Description: 定义一个纯粹执行的函数接口
     *
     * @author LiKe
     * @date 2020-09-02 21:36:33
     */
    @FunctionalInterface
    interface Runner {
        void run();
    }
}
